package com.industrial.im.factory;

import com.industrial.common.core.utils.SpringUtils;
import com.industrial.im.service.SmsSenderService;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class SmsSendFactory {

    @Value("${aliyun.sms.sendType}")
    private String sendType;

    public SmsSenderService getSmsSend() {

        try {
            SmsSenderService bean = (SmsSenderService)SpringUtils.getBean(sendType);
            return bean;
        } catch (NoSuchBeanDefinitionException e) {
            throw new RuntimeException("不支持的短信服务商");
        }

    }
}
